package com.xiaohao.communication.controller;


import com.xiaohao.communication.bean.Integration;
import com.xiaohao.communication.service.UserIntegrationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/*
*   用户积分模块（活跃值）
* */
@Controller
public class UserIntegrationController {


    @Autowired
    UserIntegrationService userIntegrationService;

    /*
    * 查询用户积分     success
    * */
    @ResponseBody
    @GetMapping("/get-integration")
    public Integration getUserIntegration(int id){
        Integration userIntegration = userIntegrationService.getUserIntegration(id);
        System.out.println(userIntegration);
        return userIntegration;
    }


    /*
     *增加用户积分        success
     * */
    @ResponseBody
    @GetMapping("/add-integration")
    public String  addUserIntegration(Integration integration){
         userIntegrationService.addUserIntegration(integration);
       return "增加success";
    }

    /*
     *减少用户积分        success
     * */
    @ResponseBody
    @GetMapping("/reduce-integration")
    public String  reduceUserIntegration(Integration integration){
        userIntegrationService.reduceUserIntegration(integration);
        return "减少success";
    }



}
